{extend name="../../admin/view/main"}

{block name='content'}
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body padding-40">
        <div class="layui-form-item relative block">
            <span class="color-green font-w7 label-required-prev">文章标签</span>
            <span class="color-desc margin-left-5">Mark Name</span>
            <div class="markbox layui-textarea">
                {foreach $mark as $tag}{if isset($vo.mark) && is_array($vo.mark) && in_array($tag.name, $vo.mark)}
                <label class="think-checkbox notselect"><input checked type="checkbox" name="mark[]" value="{$tag.name}" lay-ignore> {$tag.name}</label>
                {else}
                <label class="think-checkbox notselect"><input type="checkbox" name="mark[]" value="{$tag.name}" lay-ignore> {$tag.name}</label>
                {/if}{/foreach}
            </div>
        </div>
        <div class="layui-form-item relative block">
            <span class="color-green font-w7 label-required-prev">文章封面</span>
            <span class="color-desc margin-left-5">Conver Image</span>
            <label class="relative block label-required-null">
                <input required name="cover" value='{$vo.cover|default=""}' placeholder="请上传文章封面&nbsp;&nbsp;&nbsp;&nbsp;" class="layui-input">
                <a data-file data-type="png,jpg,gif" data-field="cover" class="input-right-icon layui-icon layui-icon-upload"></a>
                <script>$('[name="cover"]').uploadOneImage()</script>
            </label>
        </div>
        <label class="layui-form-item relative block">
            <span class="color-green font-w7">文章标题</span>
            <span class="color-desc margin-left-5">Article Name</span>
            <input required name="name" value='{$vo.name|default=""}' placeholder="请输入文章标题" class="layui-input">
        </label>
        <label class="layui-form-item relative block">
            <span class="color-green font-w7">简介描述</span>
            <span class="color-desc margin-left-5">Article Remark</span>
            <textarea required class="layui-textarea" placeholder="请输入简介描述" name="remark">{$vo.remark|default=''}</textarea>
        </label>
        <div class="layui-form-item relative block">
            <span class="color-green font-w7 label-required-prev">富文本内容</span>
            <span class="color-desc margin-left-5">Article Content</span>
            <label class="relative block">
                <textarea class="layui-textarea" placeholder="请输入文章内容" name="content">{$vo.content|default=''}</textarea>
            </label>
        </div>
        <div class="hr-line-dashed"></div>
        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn">保存数据</button>
            <button type='button' class="layui-btn layui-btn-danger" data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
        </div>
    </div>
</form>

<script>
    require(['ckeditor'], function () {
        window.createEditor('[name=content]', {height: 300});
    });
</script>
{/block}